package com.fpost.manager;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.fpost.dao.impl.DictionaryDAO;
import com.fpost.domain.Article;
import com.fpost.domain.Dictionary;

public class DictionaryManager {
	
	public Long save(Dictionary entry) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		return dao.save(entry);		
	}
	
	public void addNewWords(long articleId) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		dao.addNewWords(articleId);
	}

	public void saveOrUpdate(Dictionary entry) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		dao.saveOrUpdate(entry);
	}

	public void delete(long id) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		dao.delete(id);
		
	}

	public Dictionary get(long id) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		return dao.get(id);
	}
	
	public Dictionary getByEntry(String word) throws HibernateException {
		DictionaryDAO dao = new DictionaryDAO();
		return dao.getByEntry(word);
	}
	
	public List<Dictionary> getAll() throws HibernateException {		
		DictionaryDAO dao = new DictionaryDAO();
		return dao.getAll();
	}
	
}
